package club.pchome.controller;

import club.pchome.common.util.PageUtil;
import club.pchome.model.CSms;
import club.pchome.service.CSmsService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * @author Watler
 */
@RestController
public class CSmsController extends BaseController{

    @Autowired
    CSmsService cSmsService;

    @ApiOperation(value = "短信发送日志")
    @ApiImplicitParams({ @ApiImplicitParam(name = "currPage", value = "当前页"), @ApiImplicitParam(name = "pageSize", value = "每页条数,0为全部")})
    @PostMapping("/smsList")
    public PageUtil<CSms> smsList(HttpServletRequest request, CSms cSms, String page, String limit){
        Map<String, Object> map = new HashMap<String, Object>();

        map.put("cSms", cSms);

        PageUtil<CSms> pu = new PageUtil<CSms>(page, limit);
        return cSmsService.smsPageUtil(pu , map);
    }

}
